package priv.wjh.study.cloud.feign.api;

import com.google.gson.*;
import org.assertj.core.util.DateUtil;
import priv.wjh.study.cloud.feign.api.config.GenericWrapper;

import java.lang.reflect.Type;
import java.util.Date;

/**
 * //TODO
 *
 * @author wangjunhao
 **/
public class JsonUtil {
    public static final Gson s_gson = (new GsonBuilder()).serializeNulls().create();


    public static <T> T fromJson(String s, Class<T> parameterType) {
        return s_gson.fromJson(s, parameterType);
    }


    public static <T> T fromJson(String s, Type type) {
        return s_gson.fromJson(s, type);
    }

    public static <T> String toJson(T object) {
        return null == object ? null : s_gson.toJson(object);
    }
}
